{literal}
<script type="text/javascript">
function forumPost() {
	document.getElementById('forumSave').value=1;
	document.getElementById('managePostForm').submit();
}
function forumImageDelete( id ) {
	document.getElementById('deleteImage').value = id;
	document.getElementById('managePostForm').submit();
}
function forumAddContent( iname, add ) {
	document.getElementById(iname).value += add;
	document.getElementById(iname).focus();
}
added = new Array();
function forumAddContentClose( iname, add ) {
	tag = "tag_"+add;
	if( added[add] != true ) {
		added[add] = true;
		document.getElementById(iname).value += '['+add+']';
		document.getElementById(tag).innerHTML = "/"+document.getElementById(tag).innerHTML;
	} else {
		added[add] = false;
		document.getElementById(iname).value += '[/'+add+']';
		str = document.getElementById(tag).innerHTML;
		document.getElementById(tag).innerHTML = str.substr(1,str.length);
	}
	document.getElementById(iname).focus();
}

</script>
{/literal}

<div class="contentTitleDark">{if $edit}Muuda postitust{else}Lisa postitus{/if}</div>
{if $ok}<div class="content"><h2>{$ok}</h2></div>{/if}
{if $error}<div class="content"><center><h2>{$error}</h2></center></div>{/if}
{if !$hideForm}
<form name="newPost" id="managePostForm" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="forumSave" id="forumSave" value="0" />
<input type="hidden" name="deleteImage" id="deleteImage" value="0" />
<div class="content">
	<table>
		<tr>
			<td align="right"><strong>Pealkiri:</strong></td>
			<td><input type="black s10 n" name="title" value="{$title}" style="width:600px;"/></td>
		</tr>
		<tr>
			<td align="right"></td>
			<td><input type="checkbox" name="sendEmailOnReplay" {if $sendEmailOnReplay}checked{/if}/>Saada vastusest teade emailile</td>
		</tr>
		{if $editTopic}
		<tr>
			<td colspan="2" style="height:10px;"></td>
		</tr>
		<tr>
			<td align="right"><strong>Teema pilt:</strong></td>
		  <td>
		  {if $topicImage}<img src="{$topicImage}" style="margin:3px;"/> {/if}
		  <input type="file" name="icon"/>
			  <br />
		    See pilt kuvatakse foorumi teema ees. Kui soovite pilte lisada postitusse tehke seda allpool.</td>
		</tr>
		<tr>
			<td colspan="2" style="height:10px;"></td>
		</tr>
		{/if}
		<tr>
			<td align="right" valign="top"><strong>Sisu</strong>:</td>
			<td><textarea id="forum_contents" name="contents" style="width:600px; height:250px;">{$contents}</textarea></td>
		</tr>
		<tr>
			<td colspan="2">
				<div class="redButton" ><a href="javascript:forumAddContentClose('forum_contents', 'url')" id="tag_url"  class="red s11 b">Url</a></div>
				<div class="redButton" ><a href="javascript:forumAddContentClose('forum_contents', 'mail')" id="tag_mail"  class="red s11 b">mail</a></div>
	
				<div class="redButton" ><a href="javascript:forumAddContentClose('forum_contents', 'img')" id="tag_img"  class="red s11 b">Pilt</a></div>
				<div class="redButton" ><a href="javascript:forumAddContentClose('forum_contents', 'tsiteeri')" id="tag_url"  class="red s11 b">Tsitaat</a></div>
				<div class="redButton" ><a href="javascript:forumAddContentClose('forum_contents', 'i')" id="tag_i"  class="red s11 b">Kaldus</a></div>
				<div class="redButton" ><a href="javascript:forumAddContentClose('forum_contents', 'u')" id="tag_u"  class="red s11 b">Allajoonitud</a></div>
				<div class="redButton" ><a href="javascript:forumAddContentClose('forum_contents', 'b')" id="tag_b" class="red s11 b">Rasvane</a></div>
				<br style="clear:both"/>

				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':vihane:')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/angry.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':naeratav:')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/cheerful.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', '8)')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/cool.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':nutab:')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/cry.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':puiklev:')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/devious.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':S')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/ermm.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':kuri:')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/evil.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':irve:')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/grin.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':)')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/happy.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':D')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/laugh.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':(')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/sad.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ':p')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/tounge.gif" border="0"></a></div>
				<div class="redButton" ><a href="javascript:forumAddContent('forum_contents', ';)')" id="tag_url"  class="red s11 b"><img src="{$mediaUrl}emoticons/wink.gif" border="0"></a></div>

			</td>
		</tr>
		<tr>
			<td colspan="2">
						<span class="red s11 b">Juhised</span><br />
<b>Url</b> Lisab teksti lingi. (<span class=grey s10>[url]http://leht.ee[/url] või [url=http://leht.ee]Leht[/url]</span>)<br />
<b>Mail</b> Lisab teksti emaili saatmis võimaluse (<span class=grey s10>[mail]naide@naide.ee[/mail]</span>)<br />
<b>Pilt</b> Lisab teksti pildi (<span class=grey s10>[img]http://naide.ee/pilt.jpg[/img]</span>)<br />
			</td>
		</tr>
	</table>
</div>


{if count($images) > 0}
<div class="contentTitleDark">Lisatud pildid</div>
<div class="content">
	<table>
		{foreach item=i key=k from=$images}
		<tr>
			<td width="120" align="right"><img src="{$i->icon->getUrl()}" /></td>
			<td><textarea style="width:600px; height:80px;" name="imageComment[{$i->id}]" value="">{$i->title}</textarea></td>
			<td><a href="javascript:forumImageDelete({$k+1})" class="red s11 b">Kustuta</a></td>
		</tr>
		{/foreach}
	</table>
</div>
{/if}


<div class="contentTitleDark">Lisa pilte </div>
<div class="content">
	<table>
		<tr>
			<td width="120" align="right">Pildi fail</td>
			<td><input type="file" name="newImage"></td>
		</tr>
		<tr>
			<td align="right">Kirjeldus</td>
			<td><textarea style="width:600px; height:80px;" name="newImageComment" value=""></textarea></td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" name="addNewImage" value="Lisa pilt"></td>
		</tr>
	</table>
</div>
<div class="contentTitleDark"><center><div class="redButton" style="width:200px; float:none"><a href="javascript:forumPost()">{if $edit}Muuda{else}Lisa{/if}</a></div></center></div>
<div class="content date">PS! Foorumipostitused on tehtud Buduaari lugejate poolt ja neid ei toimetata ega tsenseerita. Buduaar ei vastuta foorumipostituste sisu eest. </div>
</form>
{/if}